#include <stdio.h>
#include <stdlib.h>
#include<string.h>
int F[21];

void fill() {
	memset(F, 0, sizeof(F));
	F[1] = F[2] = 1;
	int i;
	for (i = 3; i < 21; i++)
		if (i & 1)
			F[i] = i * F[i - 2];
		else
			F[i] = F[i - 1];
	for (i = 2; i < 21; i++)
		F[i] += F[i - 1];
}
int main(void) {
	fill();
	int a, n;
	scanf("%d", &a);
	while (a--) {
		scanf("%d", &n);
		printf("%d\n", F[n]);
	}
	return EXIT_SUCCESS;
}
